// 登陆模块
const express  = require('express')
const router = express.Router()



const multer = require('multer')
const path = require('path')
const fs = require('fs')


//引入时间模块
const {time} = require('../../config/date.js')

const {
	query
} = require('../../db/conn.js')


// 加载banner列表
router.get('/list',(req,res)=>{
	// 去查询banner列表
	 let sql = "select * from store_user"
	 query(sql).then(result=>{ 
		 	res.render('user/list',{result})
	 })
})


//删除banner接口
router.get('/delete',(req,res)=>{
	let {u_id} = req.query
	/*根据id查询该管理员的具体信息*/
	 let sql_delete = "delete  from store_user where u_id = ?"
	 query(sql_delete,[u_id]).then(result=>{
	 	    if(result){
	 			res.send('<script>alert("删除成功");location.href="/admin/user/list"</script>')
	 		}
	 	})
})

module.exports = router